package net.hust.service.impl;

import net.hust.bean.Song;
import net.hust.dao.SongDAO;
import net.hust.service.Page;
import net.hust.service.SongService;
import net.hust.service.SongQryHelper;

public class SongServiceBean implements SongService {
	private SongDAO songDao;
	
	public void setSongDao(SongDAO songDao) {
		this.songDao = songDao;
	}
	
	public void createSong(Song song) {
		
		songDao.addSong(song);
	
	}
	
	public Song getSongById(Integer id) {
		return songDao.getSongById(id);
	}
	
	public Page loadAll(Page page, SongQryHelper helper) {
		page.setTotalRecNum(new Long(songDao.getCountSongs(helper)));
		page.setContent(songDao.loadAll(page.getStartIndex().intValue(), page
				.getPageSize(), helper));
		return page;
	}
	
	public void modifySong(Song song) {
		songDao.updateSong(song);
	
	}
	
	public void removeSong(Song song) {
		songDao.deleteSong(song);
	
	}


}
